$(window).load(function() {
    $('#slider').nivoSlider({
    	effect: 'fade',
    	captionOpacity: 1,
    	directionNav: false
    });
    $('#slider-portrait').nivoSlider({
    	effect: 'fade',
    	captionOpacity: 1,
    	directionNav: true,
    	manualAdvance: true,
    	directionNavHide: false
    });
});
$(document).ready(function() {
	$('#main-menu-header').hover(function(){
		$('#main-menu > ul').css('display', 'block');
	});
	$('#main-menu-header').mouseout(function(){
		$('#main-menu > ul').css('display', 'none');
	});
	$('#main-menu > ul').mouseover(function(){
		$('#main-menu > ul').css('display', 'block');
	});
	
	$('#main-menu > ul').mouseleave(function(){
		$('#main-menu > ul').css('display', 'none');
	});
	
	if($('#mycarousel li').length > 1){
		$('#mycarousel').jcarousel({
			auto: 200,
			scroll: 1
		});
	}
	/*
	$("#portrait-image-slideshow").jcarousel({
		//auto: 10,
        scroll: 1,
        initCallback: mycarousel_initCallback
        // This tells jCarousel NOT to autobuild prev/next buttons
        //buttonNextHTML: null,
       // buttonPrevHTML: null
    });
	*/
	$("#close-portrait-slider").click(function(){
		$("#portrait-image-wapper").css('display', 'none');
	});
	$('#portrait-control a').click(function() {
		if($("#portrait-image-wapper").css('display') == 'block'){
			return false;
		}
	    //carousel.scroll($.jcarousel.intval($(this).text()));
		$('a.nivo-control[rel='+$(this).text()+']').click();
		setTimeout(function(){
			$("#portrait-image-wapper").css('display', 'block');	
		}, 500);
		
	    return false;
	});
});
/*
function mycarousel_initCallback(carousel) {
	$('#portrait-control a').bind('click', function() {
		$("#portrait-image-wapper").css('display', 'block');
        carousel.scroll($.jcarousel.intval($(this).text()));
        return false;
    });
}
*/
